<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ConfigService
 *
 * @author Administrator
 */
class ConfigService {

    function getConfigValues($configNames) {
        $configTable = D('config');
        $where['name'] = array('in', $configNames);
        $config = $configTable->where($where)->select();
        return $config;
    }

    function getConfigValue($configName) {
        $configTable = D('config');
        $where['name'] = array('eq', $configName);
        $config = $configTable->where($where)->find();
        return $config['value'];
    }
    
    function getConfig($configName){
        $configTable = D('config');
        $where['name'] = array('eq', $configName);
        $config = $configTable->where($where)->find();
        
        return $config;
    }

    function setConfigValue($configName, $configValue) {
        $configTable = D('config');
        $where['name'] = array('eq', $configName);
        $config = $configTable->where($where)->find();
        $config['value'] = $configValue;

        $configTable->save($config);
    }

}

?>
